package com.mask.sca.product.controller;

import com.mask.sca.core.response.ApiResponse;
import com.mask.sca.product.entity.Spu;
import com.mask.sca.product.service.TSpuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：jian
 * @Package：com.mask.sca.product.controller
 * @Project：mask-sca-cloud
 * @name：TSpuController
 * @Date：2025/7/25 23:04
 * @Filename：TSpuController
 */
@RestController
@RequestMapping("product")
public class TProductController {

    @Resource
    private TSpuService spuService;


    /**
     * 根据分类id获取产品列表
     * @param categoryId
     * @return
     */
    @RequestMapping("getProductList")
    public ApiResponse<List<Spu>> getProductList(@RequestParam(required = false) Long categoryId){
        List<Spu> productList = spuService.getProductList(categoryId);
        return ApiResponse.success(productList);
    }
}
